<script setup lang="ts">
import MenuCom from '@/component/menu/Menu.vue'
import {PropType} from "vue";
import {Menu} from "@/data/menu.ts";

defineProps({
  menuList: {
    type: Array as PropType<Menu[]>,
    default: () => {
      return []
    }
  }
})
</script>

<template>
  <div class="menu">
    <template v-for="menu in menuList" :key="menu.routePath">
      <el-sub-menu v-if="menu.type === 1" :index="menu.routePath">
        <template #title>{{ menu.name }}</template>
        <MenuCom v-if="menu.children && menu.children.length > 0" :menu-list="menu.children" />
      </el-sub-menu>
      <el-menu-item v-if="menu.type === 2" :index="menu.routePath">
        {{ menu.name }}
      </el-menu-item>
    </template>
  </div>
</template>

<style scoped>

</style>